Skip to content

Conversation

cdacheng
Copy link
Contributor

Add float window for hover info and default float win.

let s:float_height = 0

function! s:reset()
let s:data_buf = []
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should use 4 spaces


if !empty(a:data['response']['result']) && !empty(a:data['response']['result']['contents'])
call lsp#ui#vim#output#preview(a:data['response']['result']['contents'])
if g:lsp_hover_win == "preview" || !has("nvim-0.4.0")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of checking version can we check if the function exists?

doc/vim-lsp.txt Outdated
let g:lsp_auto_enable = 1
let g:lsp_auto_enable = 0

g:lsp_hover_win *g:lsp_hover_win*
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we change this to g:lsp_hover_ui?

doc/vim-lsp.txt Outdated
let g:lsp_auto_enable = 0

g:lsp_hover_win *g:lsp_hover_win*
Type: String
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use array of string instead.

let g:lsp_hover_ui = ['float', 'preview']

This will allow us to have a consistent pattern when we support other ui.

@prabirshrestha
Copy link
Owner

Also would be good to have a screenshot or gifs.

@cdacheng
Copy link
Contributor Author

@prabirshrestha Thanks your review and I fix all. This is a screenshot:
deepin-screen-recorder_Navigator_20190321112753

Copy link
Owner

@prabirshrestha prabirshrestha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added few more comments.

Also would it be possible to implement syntax highlighting for the preview window for markdown snippets as in preview?

return
for ui in g:lsp_hover_ui
if ui == "float"
if exists("*nvim_open_win")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we cache the exists('*nvim_open_win') in script var?

if ui == "float"
if exists("*nvim_open_win")
call lsp#ui#vim#float#float_open(a:data['response']['result']['contents'])
return
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we need to use echo '' so that the message `Retrieving hover' gets removed for both float and preview.

@prabirshrestha
Copy link
Owner

Please refer to #395 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants